package com.hpeu_12.day1223;
/**
 * @title 练习
 * @author clover
 *任意定义一个int类型的二维数组
 *如：int arr[][] = {{4,5},{6,7,10},{15,2,8}};
 *求二维数组的和？
 */
public class Test01 {
	public static void main(String[] args) {
		//用于记录二维数组的总和
		int sum = 0;
		//遍历二维数组
		int arr[][] = {{4,5},{6,7,10},{15,2,8}};
		for (int i = 0; i < arr.length; i++) {
			for (int j = 0; j < arr[i].length; j++) {
				//System.out.println(arr[i][j]);
				sum+=arr[i][j];
			}
		}
		System.out.println("总和为："+sum);
	}
}
